package com.service;

import com.dao.ActivityDao;
import com.dto.ActivityApplyDetailDTO;
import com.dto.ActivityDTO;
import com.dto.BookDTO;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author linyukun
 * @date 2022/10/8 15:58
 */
@Service
public class ActivityServiceImpl {
    @Autowired
    private ActivityDao activityDao;

    
     /**
       * 添加活动
       * @author linyukun
       * @date 2022-10-08 16:00
     */
    public Object addActivity(ActivityDTO dto) {
        //判断的操作
        activityDao.addActivity(dto);
        return dto.getId();
    }

    public Object getActivityList(ActivityDTO dto) {
        PageHelper.startPage(dto.getPageNum(), dto.getPageSize());
        //判断的操作
        return new PageInfo(activityDao.getActivityList(dto));
    }

    public Object delActivity(ActivityDTO dto) {
        return activityDao.delActivity(dto);
    }

    public Object updateActivity(ActivityDTO dto) {
        activityDao.updateActivity(dto);
        return dto.getId();
    }

    public Object getActivityById(ActivityDTO dto) {
        return activityDao.getActivityById(dto.getId());
    }

    public Object publishActivity(ActivityDTO dto) {
        return activityDao.publishActivity(dto.getId());
    }

    public Object applyActivity(ActivityApplyDetailDTO dto) {
        return activityDao.applyActivity(dto);
    }

    public Object getActivityApplyDetailList(ActivityApplyDetailDTO dto) {
        return activityDao.getActivityApplyDetailList(dto);
    }

    public Object delActivityApplyDetailById(ActivityApplyDetailDTO dto) {
        return activityDao.delActivityApplyDetailById(dto);
    }
}
